<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>首页</title>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
	<meta content="telephone=no" name="format-detection" />
	<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

	<link rel="stylesheet" href="css.css">
	<style>
	.main {
		/*这里的高度一般需要获取当前浏览器高度
		height: 200px;
		*/
	}
	
	/*
	滚动定律： 外框 window 
	*/
	.menu_window{
		height: 100%;
		position: relative;
		overflow-y:scroll;
		overflow-x:hidden;
		background: #f2f2f2;
		float: left;
		width: 30%;
	}
	.menu_doc{
	}
	.goods_window{
		height: 100%;
		position: relative;
		/*overflow-y: auto;*/
		overflow-y:scroll;
		overflow-x:hidden;
		background: #f2f2f2;
		float: left;
		width: 70%;
	}
	.goods_doc{
	}
	</style>
</head>
<body>
	<div class="main">
		<div class="menu_window">
			<div class="menu_doc">
				<ul>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU222222</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU2222</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MEN2U</li>
					<li>MENU</li>
					<li>MEN222U</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>MENU</li>
					<li>ME22NU</li>
					<li>MENU</li>
					<li>MENU</li>
				</ul>
			</div>
		</div>

		<div class="goods_window">
			<div class="goods_doc">
				<ul>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS2222</li>
					<li>GOODS</li><li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
					<li>GOODS</li>
					<li>GOODS2222</li>
					<li>GOODS2222</li>
					<li>GOODS</li>
				</ul>
			</div>
		</div>
	</div>
</body>
</html>

<script type="text/javascript">
var scrollEndCount = 0;
$(function(){
	//当前浏览器窗口高度 px
	var currentWindowHeight = $(window).height();
	var attrHeight = "height:" + currentWindowHeight + "px";
	$(".main").attr("style", attrHeight);

	var menuWindow = $(".menu_window");
	var menuDoc = $(".menu_doc");
	iscroll(menuWindow, menuDoc);

	var goodsWindow = $(".goods_window");
	var goodsDoc = $(".goods_doc");
	iscroll(goodsWindow, goodsDoc, function (){
		loadMore(scrollEndCount, 2);
	});
});
//滚动处理
function iscroll(scrollWindow, scrollDoc, scrollCallBack){
	$(scrollWindow).scroll(function() {
	var scrollTop = $(this).scrollTop();
	var windowHeight = $(this).height();
	var docHeight = $(scrollDoc).height();
	if (scrollTop -32 >= (docHeight - windowHeight)) {
		scrollEndCount ++;
		if (scrollCallBack) {
			scrollCallBack();
		};
		console.log("scroll end" + (docHeight - windowHeight - scrollTop));
	} else {
		console.log("scrolling..." + (docHeight - windowHeight - scrollTop - 32));
	}
	});
}
function loadMore(main_cate, sub_cate){
	console.log(main_cate);
	console.log(sub_cate);
}
</script>